import { getIndex } from '../../serve/home';

const state = {
  homeInfo: {},
}

const mutations = {
  updateHomeInfo: (state, params) => {
    console.log('~~~~', params)
    state.homeInfo = params;
  },
}

const actions = {
  // 在store中获取数据
  getStoreIndex({commit}, params){
    getIndex(params)
      .then(res=> {
        const {data:{object={}}} = res;
        commit('updateHomeInfo', object);
      })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
